//
//  ZDBIntegralHeadView.m
//  ZDB
//
//  Created by Kk on 2020/3/19.
//  Copyright © 2020 ZDB. All rights reserved.
//

#import "ZDBIntegralHeadView.h"
#import "ZDBIntegralAlearView.h"
@implementation ZDBIntegralHeadView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self get_up];
    }
    return self;
    
}
- (void)get_up
{
    [self addSubview:self.icon];
    [self addSubview:self.tatalLab];
    [self addSubview:self.explainLab];
}
- (UIImageView *)icon
{
    if (!_icon) {
        _icon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 46/2-20/2, 20, 20)];
        _icon.image = [UIImage imageNamed:@"jifenIcon"];
    }
    return _icon;
}
- (UILabel *)tatalLab
{
    if (!_tatalLab) {
        _tatalLab = [[UILabel alloc] initWithFrame:CGRectMake(_icon.right +4,0, 180, 21)];
        _tatalLab.font = AutoFont(14);
       
        _tatalLab.textColor = MAINTITLECOLOR;
        _tatalLab.centerY = _icon.centerY;
    
    }
    return _tatalLab;
}
- (UILabel *)explainLab
{
    if (!_explainLab) {
        _explainLab = [[UILabel alloc] initWithFrame:CGRectMake(UIScreenWidth -180-15,0, 180, 30)];
        _explainLab.font = AutoFont(14);
        
        _explainLab.textColor = MAINTITLECOLOR;
        _explainLab.textAlignment = NSTextAlignmentRight;
        _explainLab.centerY = _icon.centerY;
        NSString * str  = @" 积分说明";
        _explainLab.attributedText = [ZBDUnit getcontent:str image:@"jifenshuoming" index:0 imageframe:CGRectMake(0, -2, 14, 14)];
        
        _explainLab.userInteractionEnabled=YES;
        UITapGestureRecognizer *labelTapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labelTouchUpInside)];
           
        [_explainLab addGestureRecognizer:labelTapGestureRecognizer];
    }
    return _explainLab;
}
-(void)labelTouchUpInside{
   
    ZDBIntegralAlearView * alear = [[ZDBIntegralAlearView alloc] initWithtititle:@"积分说明" cancel:@""];
    [alear showLXAlertView];
   
}
@end
